<%-- 
    Document   : full
    Created on : 13-Nov-2012, 13:00:21
    Author     : Roald
--%>

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@page import="nl.hva.web.mvcwebapp.models.Page"%>
<%@page import="nl.hva.web.mvcwebapp.models.Widget"%>
<%@page import="nl.hva.web.mvcwebapp.models.PageWidget"%>
<%@page import="nl.hva.web.mvcwebapp.doa.PageDAO"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>

<!DOCTYPE html>
<html>
    <head>
        <script src="http://code.jquery.com/jquery-latest.js" type="text/javascript"></script>
        <link href="${requestScope.css}" type="text/css" rel="stylesheet" />
        <title> ${requestScope.title} </title>
        <link rel="shortcut icon" type="image/x-icon" href="images/favicon.ico">
    </head>
    <div class="error">
    </div>
    <body class="${requestScope.background} ${requestScope.color}">
        <div class="bg">
            <div class="wrapper"> <!-- Start Wrapper -->
                <c:if test="${not empty requestScope.header}"> 
                    <c:catch var="headerCatch">
                        <c:forEach var="tempHeaderWidget" items="${requestScope.header}"> 
                            <c:if test="${requestScope.header.size >= 2}"> <hr /></c:if>
                            <jsp:include page="${tempHeaderWidget.widgetPath}" /> 
                        </c:forEach>
                    </c:catch>
                    <c:if test="${headerCatch!=null}">
                        <jsp:include page="/WEB-INF/widgets/top-navigation.jsp" /> 
                        <div class="error">
                            This widget failed to load!<br/>
                            <i>${headerCatch.message}</i>
                        </div>
                    </c:if>
                </c:if>
                <div class="content-wrapper">
                    <c:if test="${not empty requestScope.top}"> 
                        <c:catch var="topCatch">
                            <c:forEach var="tempTopWidget" items="${requestScope.top}"> 
                                <jsp:include page="${tempTopWidget.widgetPath}" /> 
                            </c:forEach>
                        </c:catch>
                        <c:if test="${topCatch!=null}">
                            <div class="error">
                                This widget failed to load!<br/>
                                <i>${topCatch.message}</i>
                            </div>
                        </c:if>
                    </c:if>
                    <div class="content full">
                        <!--page specific content -->
                        <jsp:include page="${requestScope.body}" />
                    </div>

                    <br class="clearfix">

                    <!-- Footer -->
                    <c:if test="${not empty requestScope.bottom}"> 
                        <c:catch var="bottomCatch">
                            <c:forEach var="tempBottomWidget" items="${requestScope.bottom}"> 
                                <hr/>
                                <jsp:include page="${tempBottomWidget.widgetPath}" /> 
                            </c:forEach>
                        </c:catch>
                        <c:if test="${bottomCatch!=null}">
                            <div class="error">
                                This widget failed to load!<br/>
                                <i>${bottomCatch.message}</i>
                            </div>
                        </c:if>
                    </c:if>
                </div> <!-- End content-wrapper -->
                <c:if test="${not empty requestScope.footer}"> 
                    <c:catch var="footerCatch">
                        <c:forEach var="tempFooterWidget" items="${requestScope.footer}"> 
                            <jsp:include page="${tempFooterWidget.widgetPath}" /> 
                        </c:forEach>
                    </c:catch>
                    <c:if test="${footerCatch!=null}">
                        <jsp:include page="/WEB-INF/templates/footer.jsp" /> 
                        <div class="error">
                            This widget failed to load!<br/>
                            <i>${footerCatch.message}</i>
                        </div>
                    </c:if>
                </c:if>
            </div> <!-- End Wrapper -->

        </div>
    </body>
</html>